Refactoring compilation engine#300
Conversation
|
@claude review pr with inline comments |
|
Claude finished @unv-unv's task in 3m 0s —— View job PR Review: Refactoring compilation engine
I reviewed all 11 changed files. The bulk of this PR is a clean mechanical reformat (tabs → 4-space indent, I did find 3 bugs introduced by the migration, posted as inline suggestions you can apply with one click:
The common thread for #2 and #3: the fluent API is lazy — building a Minor notes (no inline comment needed)
Nice cleanup overall — once the three |
| return true; | ||
| } | ||
| if (line.endsWith("java.lang.OutOfMemoryError")) { | ||
| callback.newError(CompilerLocalize.errorJavacOutOfMemory()); |
There was a problem hiding this comment.
Bug: message is never reported — missing .add().
Every other newError(...)/newInfo(...) call in this file ends with .add(), but here the built MessageBuilder is discarded, so the out-of-memory error is silently dropped. In the pre-refactor code this was addMessage(callback, CompilerMessageCategory.ERROR, ...), which did report it.
| callback.newError(CompilerLocalize.errorJavacOutOfMemory()); | |
| callback.newError(CompilerLocalize.errorJavacOutOfMemory()).add(); |
| wrapper.compile(parsingInfo); | ||
| } | ||
| catch (CompilerException e) { | ||
| context.newError(LocalizeValue.of(ExceptionUtil.getThrowableText(e))); |
There was a problem hiding this comment.
Bug: compiler error is swallowed — missing .add().
When wrapper.compile(...) throws a CompilerException, the error is built but never added to the context, so the failure is only logged to idea.log and the user sees a "successful" compile with no error message. Previously this path called context.addMessage(CompilerMessageCategory.ERROR, ...).
| context.newError(LocalizeValue.of(ExceptionUtil.getThrowableText(e))); | |
| context.newError(LocalizeValue.of(ExceptionUtil.getThrowableText(e))).add(); |
| try { | ||
| VirtualFile fileByURL = VirtualFileUtil.findFileByURL(new URI(url).toURL()); | ||
| if (fileByURL != null) { | ||
| return url(fileByURL.getUrl()); |
There was a problem hiding this comment.
Bug: infinite recursion / StackOverflowError. url(...) is the wrapper's own method, not the delegate's. On a successful lookup it re-invokes itself with the resolved VirtualFile.getUrl(), which resolves to the same file again and recurses forever (the message is also never forwarded to the delegate). This should delegate instead:
| return url(fileByURL.getUrl()); | |
| return myDelegate.url(fileByURL.getUrl()); |
|
@claude review pr with inline comments |
|
Claude finished @unv-unv's task in 4m 2s —— View job PR Review (re-review): Refactoring compilation engine
✅ All three previously-flagged bugs are now fixed (commit
|
| # | File · line | Status |
|---|---|---|
| 1 | JavaToolMonitor.java:191 |
Fixed — now return myDelegate.url(fileByURL.getUrl());, no more self-recursion / StackOverflowError. |
| 2 | JavaCompiler.java:111 |
Fixed — CompilerException path now ends with .add(), so the error is reported. |
| 3 | JavacOutputParser.java:163 |
Fixed — the OutOfMemoryError branch now ends with .add(). |
I re-scanned every new{Error,Warning,Info,Message}(…) call across all 11 changed files: each builder chain is now terminated with .add(). No remaining dropped-message regressions from the fluent-API migration.
Minor note (non-blocking)
OutputParser.java(last line,}at line 96) still has no trailing newline at end of file — the siblingJavacOutputParser.javawas given one in this PR, so it's worth matching for consistency. One-line fix: add a final newline.- (I tried to attach this as a one-click inline
suggestion, but the CI shell guard blocks the newline-escaping needed to post a suggestion block viagh api; flagging here instead.)
- (I tried to attach this as a one-click inline
Verdict
The refactor is a clean mechanical reformat (tabs → 4-space, final/diamond cleanup) plus a consistent migration to the fluent MessageBuilder API, and the lazy-API hazard that caused bugs #2/#3 has been swept across the changed files. With the three fixes landed, this looks good to merge — the only outstanding item is the trivial trailing-newline nit above.
· branch refactoring-compilation-engine
No description provided.